package com.xianggu.mybatis.headlerImpl;

import com.xianggu.mybatis.utils.TypeHandler;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

/**
 * @author chengjy
 * @date 2025/3/5
 */
public class MapTypeHandler implements TypeHandler<Map<String , Object>> {

    @Override
    public void setPreparedStatementValue(PreparedStatement preparedStatement, int i, Map<String, Object> objectMap, String pName) {
        try {
            Object value = objectMap.get(pName);
            preparedStatement.setObject( i , value);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Map<String, Object> getParameterValue(ResultSet resultSet, String columnName) {
        return null;
    }

    @Override
    public Map<String, Object>  toBaseType(Object num) {
        return null;
    }
}
